<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  {include="style"}

</head>
<body >

  <div class="layui-rows" style="    margin: 10px;">
    <form class="layui-form layui-form-pane" action="">
  <!--表单必须要携带ID-->
  <blockquote class="layui-elem-quote">QQ登录配置</blockquote>
  <input name="id" value="{$plugins['id']}" type="hidden">
   <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">appid </label>
    <div class="layui-input-block">
      <input type="text" name="appid" value="{$config['appid']}" placeholder="请填写应用的appid"  class="layui-input" />
    </div>
    </div>
    <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">appsecret </label>
    <div class="layui-input-block">
      <input type="text" name="appsecret" value="{$config['appsecret']}" placeholder="请填写应用的appsecret"  class="layui-input" />
    </div>
    </div>
     <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">QQ前台登录地址 <b class="x-red">将该地址放到QQ应用平台回调地址</b></label>
    <div class="layui-input-block">
      <input type="text" name="return_url" value="{if(isset($config['return_url']))}{$config['return_url']}{else}{fun get_domain()}/qq/index{/if}" placeholder="无需填写"  readonly="readonly" class="layui-input" />
    </div>
    
    </div>
      
   
    
   
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>

    </div>
  </div>
</form>
</div>





    <script>
        $(function  () {
      
            layui.use('form', function(){
              var form = layui.form;
             
              //监听提交
              form.on('submit(formDemo)', function(data){
           
        $.post("{fun U('setconf')}",data.field,function(res){
            //console.log(res);return false;
           var res = JSON.parse(res);
           if(res.code==1){
            layer.msg(res.msg);
           }else{
            layer.msg(res.msg, {icon: 6,time: 2000},function(){
            window.location.reload();
            });
                     
            
             
           }
        })
        
                return false;
              });
            });
        })

        
    </script>

    
 
</body>
</html>